package com.speed_run.vo;

import java.util.Date;

import com.speed_run.global.LoginType;
import lombok.Getter;
import lombok.Setter;

import com.speed_run.model.UserAuth;
import com.speed_run.model.UserInfo;
import com.speed_run.utils.CommonUtils;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

public class UserRegVo {
    /**
     * 手机号
     */
    @NotEmpty
    private String telephone;

    /**
     * 短信验证码
     */
    @NotEmpty
    private String smsCode;

    /**
     * 新密码
     */
    @Length(min = 6,max = 16)
    @NotEmpty
    private String password;

    public String getTelephone() {
        return telephone;
    }

    public void setTelphone(String telephone) {
        this.telephone = telephone;
    }

    public String getSmsCode() {
        return smsCode;
    }

    public void setSmsCode(String smsCode) {
        this.smsCode = smsCode;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public UserInfo userInfo(){
        UserInfo user = new UserInfo();
        String name = CommonUtils.getRandomName();
        user.setNickName(name);
        user.setUserId(name);
        user.setTelphone(telephone);
        return user;
    }

    public UserAuth authInfo(String id, LoginType type){
        UserAuth info = new UserAuth();
        info.setUserId(id);
        info.setAuthType(type.toString());
        return info;
    }
}
